<?php
$array_1 = array(); //一纬数组
$array_2 = array(); //多纬数组

$array_1['username'] = "ericwolf";
$array_1['age'] = 25;

$array_2['member']['yuanminghe']['username']="ericwolf";
$array_2['member']['yuanminghe']['age'] = 25;

$array_2['member']['zhangsan']['username']="yuanminghe";
$array_2['member']['zhangsan']['age'] = 26;

// print_r($array_1);

// $jsonObj_1 = json_encode($array_1);
// echo $jsonObj_1;

// $jsonObj_2 = json_encode($array_2);
// echo $jsonObj_2;


class muke{
	public  $name = "public Name";
	protected $ptName = "protected Name";
	private $pName = "private Name";
	
	public function getName() {
		return $this->name;
	}
}


$mukeObj = new muke();
// print_r($mukeObj);
$obj2Json = json_encode($mukeObj); //只会转化公有属性
echo $obj2Json;

//json 转化成普通数据格式
$jsonStr = '{"key":"value","key1":"value1"}';
echo $jsonStr;

//默认转换成对象， 第二个参数true就转化成数组了
$json2Array = json_decode($jsonStr,true);
print_r($json2Array);



?>